package com.ft.oa.mapper.project;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ft.oa.domain.project.ExecProject;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 项目立项表DAO
 * @author hefeng
 * @ClassName ExecProjectMapper
 * @date 2021/12/31 10:21
 */
public interface ExecProjectMapper extends BaseMapper<ExecProject> {

    @Select("select a.* from exec_project a left join clue_project b on a.clue_project_id = b.id " +
            "where b.customer_company_id = #{id} and  a.approval_status = 1 and a.search_type = 'par' " +
            "UNION " +
            "select a.* from exec_project a left join bid_project b on a.bid_project_id = b.id " +
            "left join clue_project c on b.related_project_cues_id = c.customer_company_id " +
            "where c.customer_company_id = #{id} and  a.approval_status = 1 and a.search_type = 'par' and a.bid_project_id is not null")
    List<ExecProject> getListBySql(@Param("id") Long id);


}
